package com.mm.cloud.lease.service.impl.convert.housing;

import com.mm.cloud.lease.dto.housing.form.SaveHousingDTO;
import com.mm.cloud.lease.dto.housing.form.UpdateHousingDTO;
import com.mm.cloud.lease.entity.Housing;
import com.mm.cloud.lease.vo.housing.HousingVO;

public class HousingConvert {

    /**
     * @return Housing
     * @Description: 转换 SaveHousingDTO 为 Housing
     */
    public static Housing convert(SaveHousingDTO dto) {
        Housing housing = new Housing();
        housing.setCityId(dto.getCityId());
        housing.setAreaId(dto.getAreaId());
        housing.setStoreId(dto.getStoreId());
        housing.setGroupId(dto.getGroupId());
        housing.setHousingTypeId(dto.getHousingTypeId());
        housing.setHousingCode(dto.getHousingCode());
        housing.setPropertyAddressId(dto.getPropertyAddressId());
        housing.setBuilding(dto.getBuilding());
        housing.setUnitName(dto.getUnitName());
        housing.setIsLift(dto.getIsLift());
        housing.setLeaseType(dto.getLeaseType());
        return housing;
    }

    public static Housing convert(UpdateHousingDTO dto) {
        Housing housing = convert((SaveHousingDTO) dto);
        housing.setId(dto.getId());
        return housing;
    }

    /**
     * @return HousingVO
     * @Description: 转换 Housing 为 HousingVO
     */
    public static HousingVO convert(Housing housing) {
        HousingVO housingVO = new HousingVO();
        housingVO.setId(housing.getId());
        housingVO.setCityId(housing.getCityId());
        housingVO.setAreaId(housing.getAreaId());
        housingVO.setStoreId(housing.getStoreId());
        housingVO.setGroupId(housing.getGroupId());
        housingVO.setHousingTypeId(housing.getHousingTypeId());
        housingVO.setHousingCode(housing.getHousingCode());
        housingVO.setPropertyAddressId(housing.getPropertyAddressId());
        housingVO.setBuilding(housing.getBuilding());
        housingVO.setUnitName(housing.getUnitName());
        housingVO.setIsLift(housing.getIsLift());
        housingVO.setRoomCount(housing.getRoomCount());
        housingVO.setRestRoomCount(housing.getRestRoomCount());
        housingVO.setTotalFloor(housing.getTotalFloor());
        housingVO.setCreateTime(housing.getCreateTime());
        housingVO.setUpdateTime(housing.getUpdateTime());
        housingVO.setCreaterId(housing.getCreaterId());
        housingVO.setUpdaterId(housing.getUpdaterId());
        return housingVO;
    }

}
